package pl.un4giv3n.mightvsmagic.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
@NamedQueries({
	@NamedQuery(name="find.all.messages.by.userId", query="select p from PremiumCode p where p.userId = :userId"),
})
@Entity
public class PremiumCode {

	private Long id;
	private long userId;
	private String code;
	private long time;
	private String validationResult;
	
	
	public PremiumCode(){
	}
	
	public PremiumCode(long userId, String code, String validationResult){
		this.userId = userId;
		this.code = code;
		this.validationResult = validationResult;
		this.time = System.currentTimeMillis();
	}
	
	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}
	
	void setId(Long id) {
		this.id = id;
	}

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public long getTime() {
		return time;
	}

	public void setTime(long time) {
		this.time = time;
	}

	public String getValidationResult() {
		return validationResult;
	}

	public void setValidationResult(String validationResult) {
		this.validationResult = validationResult;
	}
	
	
	@Override
	public String toString() {
		return "Id="+id+", code="+code+", time="+time+", validation="+validationResult;
	}
}
